﻿<UserControl x:Class="Microsoft.Research.Provenance.Controls.View.ActivityDataProductView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             Height="Auto" Width="Auto" AutomationProperties.Name="AIDActivityDataProductView">
    <UserControl.Resources>
        <DataTemplate x:Key="DataProductTemplate">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="20"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Image Source="{Binding Path=ImageSource}" MouseLeftButtonDown="OnLinkClick" Cursor="Hand"
                       Width="18" Height="18" Margin="0,0,5,0" />
                <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding Path=Name}" TextWrapping="Wrap"
                           Grid.Column="1" Margin="4,0,0,0" MouseLeftButtonDown="OnLinkClick" Cursor="Hand" Foreground="Blue" TextDecorations="Underline"/>
			</Grid>
        </DataTemplate>
        <BooleanToVisibilityConverter x:Key="boolToVisibilty"/>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot">
        <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderBrush="#FFC8C8C8" BorderThickness="1,1,1,1" CornerRadius="5,5,5,5">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="25"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Border HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Grid.Row="0" CornerRadius="5,5,0,0">
                    <Border.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FFFFFFFF" Offset="0"/>
                            <GradientStop Color="#FFE8E8E8" Offset="1"/>
                        </LinearGradientBrush>
                    </Border.Background>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="40"/>
                        </Grid.ColumnDefinitions>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding Path=ActivityLabel}" TextWrapping="Wrap" Margin="5,0,0,0" FontSize="13"/>
                            <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Text=" - Data Products" TextWrapping="Wrap" Margin="0,0,0,0" FontSize="13"/>
                        </StackPanel>
                    </Grid>
                </Border>
				<Border Grid.Row="1" Margin="5,5,5,5" HorizontalAlignment="Stretch" CornerRadius="5,5,5,5" BorderThickness="1,1,1,1" BorderBrush="#FFD0D0D0" Height="30" Visibility="{Binding Converter={StaticResource boolToVisibilty}, Path=IsBreadcrumbNull}" x:Name="breadcrumbBorder">
                	<TextBlock Width="Auto" Height="Auto" Text="{Binding Path = Breadcrumb}" TextWrapping="Wrap" Margin="2,2,2,2" x:Name="breadcrumbText"/>
                </Border>
                <Border Grid.Row="2" Visibility="{Binding Converter={StaticResource boolToVisibilty}, Path=DoesNotContainItems}">
                    <TextBlock Margin="5,5,5,5" Text="No data products available."/>
                </Border>
                <Grid Grid.Row="2" Visibility="{Binding Converter={StaticResource boolToVisibilty}, Path=ContainItems}" Height="Auto">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <ListBox Height="275" VerticalAlignment="Top"
                        IsSynchronizedWithCurrentItem="True" 
                        ItemTemplate="{StaticResource DataProductTemplate}" 
                        Name="listDataProduct" 
                        ItemsSource="{Binding Path=ActivityDataProducts}"/>
                </Grid>
            </Grid>
        </Border>
    </Grid>
 
</UserControl>
